import Vue from 'vue'
import Router from 'vue-router'

import login from '@/views/login/login.vue'
import forget from '@/views/login/forget.vue'
import forget2 from '@/views/login/forget2.vue'
import register from '@/views/login/register.vue'
import register2 from '@/views/login/register2.vue'
import protocol from '@/views/login/protocol.vue'

import s404 from '@/views/status/404.vue'

import index from '@/views/index.vue'
import topics from '@/views/topics/topics.vue'
import tdetail from '@/views/topics/tdetail.vue'

import message from '@/views/message/message.vue'
import messageList from '@/views/message/messageList'

import consult from '@/views/consult/consult.vue'
import services from '@/views/consult/services.vue'

import masters from '@/views/master/masters.vue'
import mdetail from '@/views/master/mdetail.vue'
import payfor from '@/views/master/payfor.vue'
import pay from '@/views/master/pay.vue'
import payAlipay from '@/views/master/pay-alipay'

import shop from '@/views/shop/shop.vue'

import my from '@/views/my.vue'
import inferNumber from '@/views/my/inferNumber.vue'
import attention from '@/views/my/attention.vue'
import collectgoods from '@/views/my/collectgoods.vue'
import datum from '@/views/my/datum.vue'
import horoscope from '@/views/my/horoscope.vue'
import birthlist from '@/views/my/birthList.vue'
import modifyname from '@/views/my/modifyName.vue'
import orderform from '@/views/my/orderForm.vue'
import service from '@/views/my/service.vue'
import changepsd from '@/views/my/changepsd.vue'
import binding from '@/views/my/binding.vue'
import siteList from '@/views/my/siteList.vue'
import addSite from '@/views/my/addSite.vue'
import discountCoupon from '@/views/my/discountCoupon.vue'
import approve from '@/views/my/approve.vue'
import recommend from '@/views/my/recommend.vue'
import signIn from '@/views/my/signIn.vue'
import member from '@/views/my/member.vue'
import fans from '@/views/masterInfo/fans.vue'
import masterOrder from '@/views/masterInfo/masterOrder.vue'
import personalData from '@/views/masterInfo/personalData.vue'
import partner from '@/views/my/partner.vue'
import myService from '@/views/masterInfo/myService.vue'
import setService from '@/views/masterInfo/setService'
import invite from '@/views/my/invite'
import flashAsked from '@/views/my/flashAsked'
import flashAnswer from '@/views/my/flashAnswer'
import bill from '@/views/masterInfo/bill'
import deposit from '@/views/masterInfo/deposit'
import income from '@/views/masterInfo/income'
import detail from '@/views/masterInfo/detail'
import showDetails from '@/views/masterInfo/showDetails'
import flashMaster from '@/views/my/flashMaster'
import addAlipay from '@/views/masterInfo/addAlipay'
import myClient from '@/views/masterInfo/myClient'
import clientDetails from '@/views/masterInfo/clientDetails'
import clientMaster from '@/views/masterInfo/clientMaster'
import clientUser from '@/views/masterInfo/clientUser'
import refund from '@/views/masterInfo/refund'

import searchList from '@/views/search/searchList'
import searchResult from '@/views/search/searchResult'

import setting from '@/views/setting/setting.vue'
import safety from '@/views/setting/safety.vue'
import opinion from '@/views/setting/opinion.vue'

import userAdvisory from '@/views/userAdvisory.vue'
import masterAdvisory from '@/views/masterAdvisory.vue'

import interact from '@/views/interact/interact.vue'
import fastquestion from '@/views/interact/fastquestion.vue'
import fastasked from '@/views/interact/fastasked.vue'
import servicesdetail from '@/views/interact/servicesDetail.vue'
import selectques from '@/views/interact/selectques.vue'
import questionDetail from '@/views/interact/questionDetail.vue'
import questionList from '@/views/interact/fastquestionList.vue'
import selectmaster from '@/views/interact/selectmaster.vue'

Vue.use(Router)

export default new Router({
  // mode: 'history',
  routes: [
    {
      path: '*',
      name: '404',
      component: s404,
    },
    {
      path: '/',
      redirect: 'index',
    },
    {
      path: '/index',
      name: 'index',
      component: index,
    },
    {
      path: '/message',
      name: 'message',
      component: message,
    },
    {
      path: '/messageList',
      name: 'messageList',
      component: messageList,
    },
    {
      path: '/topics',
      name: 'topics',
      component: topics,
    },
    {
      path: '/topics/:id',
      name: 'tdetail',
      component: tdetail,
    },
    {
      path: '/consult',
      name: 'consult',
      component: consult,
    },
    {
      path: '/services',
      name: 'services',
      component: services,
    },
    {
      path: '/interact',
      component: interact,
      children: [
        {
          path: '',
          name: 'interact-ques',
          component: fastquestion
        },
        {
          path: 'asked',
          name: 'interact-ask',
          component: fastasked
        }
      ]
    },
    {
      path: '/servicesdetail',
      name: 'sdeatil',
      component: servicesdetail
    },
    {
      path: '/selectques',
      name: 'selectques',
      component: selectques
    },
    {
      path: '/selectmaster',
      name: 'selectmaster',
      component: selectmaster
    },
    {
      path: '/questionlist',
      name: 'questionList',
      component: questionList
    },
    {
      path: '/questiondetail',
      name: 'questiondetail',
      component: questionDetail
    },
    {
      path: '/shop',
      name: 'shop',
      component: shop,
    },
    {
      path: '/my',
      name: 'my',
      component: my,
      meta: {
        requireAuth: true,
      }
    },
    {
      path: '/masters',
      name: 'masters',
      component: masters,
    },
    {
      path: '/mdetail',
      name: 'mdetail',
      component: mdetail,
    },
    {
      path: '/payfor',
      name: 'payfor',
      component: payfor,
    },
    {
      path: '/pay',
      name: 'pay',
      component: pay,
    },
    {
      path: '/payAlipay',
      name: 'payAlipay',
      component: payAlipay
    },
    {
      path: '/login',
      name: 'login',
      component: login,
    },
    {
      path: '/forget',
      name: 'forget',
      component: forget,
    },
    {
      path: '/forget2',
      name: 'forget2',
      component: forget2,
    },
    {
      path: '/register',
      name: 'register',
      component: register,
    },
    {
      path: '/register2',
      name: 'register2',
      component: register2,
    },
    {
      path: '/protocol',
      name: 'protocol',
      component: protocol,
    },
    { // 我的关注
      path: '/attention',
      name: 'attention',
      component: attention,
    },
    { // 收藏商品
      path: '/collectgoods',
      name: 'collectgoods',
      component: collectgoods
    },
    { // 修改资料
      path: '/datum',
      name: 'datum',
      component: datum
    },
    { // 新建八字
      path: '/horoscope',
      name: 'horoscope',
      component: horoscope
    },
    { // 八字列表
      path: '/birthlist',
      name: 'birthlist',
      component: birthlist
    },
    { // 修改昵称
      path: '/modifyname',
      name: 'modifyname',
      component: modifyname
    },
    { // 订单列表
      path: '/orderform',
      name: 'orderform',
      component: orderform
    },
    { // 联系客服
      path: '/service',
      name: 'service',
      component: service
    },
    { // 修改密码
      path: '/changepsd',
      name: 'changepsd',
      component: changepsd
    },
    { // 更换手机号
      path: '/binding',
      name: 'binding',
      component: binding
    },
    { // 收货地址添加 
      path: '/siteList',
      name: 'siteList',
      component: siteList
    },
    { // 添加收货地址
      path: '/addSite',
      name: 'addSite',
      component: addSite
    },
    { // 我的优惠券
      path: '/discountCoupon',
      name: 'discountCoupon',
      component: discountCoupon
    },
    { // 认证大师
      path: '/approve',
      name: 'approve',
      component: approve
    },
    { // 推荐好友
      path: '/recommend',
      name: 'recommend',
       component: recommend
    },
    { // 签到
      path: '/signIn',
      name: 'signIn',
      component: signIn
    },
    { // 黑卡会员
      path: '/member',
      name: 'member',
      component: member
    },
    { // 大师订单
      path: '/masterOrder',
      name: 'masterOrder',
      component: masterOrder
    },
    { // 我的粉丝
      path: '/fans',
      name: 'fans',
      component: fans
    },
    { // 大师-个人资料
      path: '/personalData',
      name: 'personalData',
      component: personalData
    },
    { // 用户咨询
      path: '/userAdvisory',
      name: 'userAdvisory',
      component: userAdvisory
    },
    { // 大师咨询
      path: '/masterAdvisory',
      name: 'masterAdvisory',
      component: masterAdvisory
    },
    { // 招募
      path: '/partner',
      name: 'partner',
      component: partner
    },
    { // 我的服务
      path: '/myService',
      name: 'myService',
      component: myService
    },
    { // 添加服务
      path: '/setService',
      name: 'setService',
      component: setService
    },
    { // 推荐好友
      path: '/invite',
      name: 'invite',
      component: invite
    },
    { // 设置
      path: '/setting',
      name: 'setting',
      component: setting
    },
    { //账户安全
      path: '/safety',
      name: 'safety',
      component: safety
    },
    { // 意见反馈
      path: '/opinion',
      name: 'opinion',
      component: opinion
    },
    { // 闪问聊天
      path: '/flashAsked',
      name: 'flashAsked',
      component: flashAsked
    },
    { // 闪答聊天
      path: '/flashAnswer',
      name: 'flashAnswer', 
      component: flashAnswer
    },
    { // 我的账单
      path: '/bill',
      name: 'bill',
      component: bill
    },
    { // 提现
      path: '/deposit',
      name: 'deposit',
      component: deposit
    },
    { // 收入账单
      path: '/income',
      name: 'income',
      component: income
    },
    { // 提现明细
      path: '/detail',
      name: 'detail',
      component: detail
    },
    { //提现详情
      path: '/showDetails',
      name: 'showDetails',
      component: showDetails
    },
    {
      path: '/flashMaster',
      name: 'flashMaster',
      component: flashMaster
    },
    { // 添加提现账户
      path: '/addAlipay',
      name: 'addAlipay',
      component: addAlipay,
    },
    { // 我的客户
      path: '/myClient',
      name: 'myClient',
      component: myClient,
      children: [
        {
          path: '',
          name: 'clientMaster',
          component: clientMaster,
        }, 
        {
          path: 'clientUser',
          name: 'clientUser',
          component: clientUser,
        }
      ]
    },
    { // 客户详情
      path: '/clientDetails',
      name: 'clientDetails',
      component: clientDetails
    },
    { // 退款操作
      path: '/refund',
      name: 'refund',
      component: refund
    },
    { // 搜索列表 
      path: '/searchList',
      name: 'searchList',
      component: searchList
    },
    {
      path: '/searchResult',
      name: 'searchResult',
      component: searchResult
    },
    {
      path: '/inferNumber',
      name: 'inferNumber',
      component: inferNumber
    }
  ],
  scrollBehavior(to, from, savedPosition) {
    return {
      x: 0,
      y: 0
    }
  }
})
